<template>
    <div class="popup" @click="hidePopup">
        <div class="popup-container" ref="wrapper">
            <div class="popup-content">
                <div
                    class="popup-list"
                    v-for="(item, index) in data.orderDetailList"
                    :key="index"
                >
                    <div class="goods-header">
                        <span>{{ item.productQuantity }}</span>
                        <img :src="item.productIcon" alt="" />
                    </div>
                    <div class="goods-name">{{ item.productName }}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import BScroll from "better-scroll";

export default {
    props: ["data"],
    data() {
        return {
            // show: false,
            showBScroll: null,
        };
    },
    mounted() {
        console.log(this.data);
        this.$nextTick(() => {
                this.initSrcoll();
                this.showBScroll.refresh();
            });
    },
    methods: {
        initSrcoll() {
            this.showBScroll = new BScroll(this.$refs.wrapper, {
                scrollY: true,
                probeType: 3,
            });
        },
        hidePopup() {
            this.$store.state.showPopup = !this.$store.state.showPopup;
        },
    },
};
</script>

<style lang="less" scoped>
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 5;
    .popup-container {
        width: 30%;
        height: 100vh;
        position: absolute;
        top: 0;
        right: 0;
        z-index: 100;
        overflow: hidden;
        background: @bg-m;
        border-radius: 15px 0 0 15px;
        .popup-content {
            padding: 20px;
            .popup-list {
                display: flex;
                flex-direction: column;
                margin-bottom: 10px;
                padding-bottom: 10px;
                align-items: center;
                .goods-header {
                    position: relative;
                    span {
                        width: 15px;
                        height: 15px;
                        padding: 5px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        font-size: 14px;
                        position: absolute;
                        top: -10px;
                        right: -10px;
                        color: #fff;
                        background: @c-m;
                        border-radius: 50%;
                    }
                    img {
                        width: 89px;
                        height: 89px;
                        border-radius: 10px;
                    }
                }
                .goods-name {
                    width: 100%;
                    font-size: 16px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }
            }
        }
    }
}
</style>